const KEY = "my-app";
type Token = {
  accessToken: string;
  refreshToken: string;
};
export const getTokens = (): Token | null => JSON.parse(localStorage.getItem(KEY)!) || ({} as Token);

export const setTokens = (tokens: Token) => localStorage.setItem(KEY, JSON.stringify(tokens));

export const removeTokens = () => localStorage.removeItem(KEY);

export const isAuth = () => !!getTokens()?.accessToken;
